# from sqlalchemy import create_engine, Column, Integer, String, BigInteger, Boolean, DateTime, JSON
# from sqlalchemy.ext.declarative import declarative_base
# from sqlalchemy.orm import sessionmaker
# from datetime import datetime
# import os

# # 数据库连接 URL
# # 格式: mysql+pymysql://用户名:密码@主机:端口/数据库名
# SQLALCHEMY_DATABASE_URL = "mysql+pymysql://root:123456@localhost:3306/qizhiyun"

# engine = create_engine(SQLALCHEMY_DATABASE_URL, pool_pre_ping=True)
# SessionLocal = sessionmaker(autocommit=False, autoflush=False, bind=engine)

# Base = declarative_base()

# # 定义模型
# class FileMetadata(Base):
#     __tablename__ = "file_metadata"

#     id = Column(BigInteger, primary_key=True, index=True)
#     filename = Column(String(255), nullable=False)
#     original_path = Column(String(1024), nullable=False, unique=True, index=True)
#     size = Column(BigInteger, nullable=False)
#     content_type = Column(String(255), default="application/octet-stream")
#     uploaded_by = Column(String(100), nullable=False)
#     uploaded_at = Column(DateTime, default=datetime.utcnow)
#     last_modified = Column(DateTime, default=datetime.utcnow, onupdate=datetime.utcnow)
#     is_deleted = Column(Boolean, default=False)
#     is_public = Column(Boolean, default=False)
#     metadata = Column(JSON, nullable=True)